package com.aop.config;

import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author wzm
 * @create 2023-10-17 15:41
 * project_name:javaweb2308
 */
@Configuration //表示该类是一个配置类 SpringBoot启动会自动加载
public class DataSourceConfig {


    @Bean   //将方法的返回值对象加入到IOC容器中 默认名字就是方法名（首字母小写）
    public DruidDataSource dataSource01(){
        DruidDataSource druidDataSource = new DruidDataSource();
        druidDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
        druidDataSource.setUsername("root");
        druidDataSource.setPassword("root");
        return druidDataSource;
    }



}
